<?php
/**
 # com_jvframwork - JV Framework
 # @version		1.5.x
 # ------------------------------------------------------------------------
 # author    Open Source Code Solutions Co
 # copyright Copyright (C) 2011 joomlavi.com. All Rights Reserved.
 # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL or later.
 # Websites: http://www.joomlavi.com
 # Technical Support:  http://www.joomlavi.com/my-tickets.html
-------------------------------------------------------------------------*/

// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();

/**
 * Renders a list element
 *
 * @package 	Joomla.Framework
 * @subpackage		Parameter
 * @since		1.5
 */

class JElementLayouttype extends JElement
{
	/**
	* Element type
	*
	* @access	protected
	* @var		string
	*/
	var	$_name = 'Layouttype';

	function fetchElement($name, $value, &$node, $control_name)
	{
		$class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="inputbox"' );

		$options = array ();
		foreach ($node->children() as $option)
		{
			$val	= $option->attributes('value');
			$text	= $option->data();
            if($node->attributes('class') == true){
                $options[] = JHTML::_('select.option', $val, '<img src="'.JVFactory::getJVLayout()->getBaseThemesUrl().$text.'" alt="layout1" />');    
            }else{
                $options[] = JHTML::_('select.option', $val, '<img src="'.JVFactory::getJVLayout()->getBaseThemesUrl().$text.'" alt="layout1" />');
            }
            
            if($val == $value){
                JFactory::getDocument()->addScriptDeclaration(
                "
                 window.addEvent('domready', function() {
                    $$('label[for={$control_name}{$name}{$val}]').addClass('active');
                 });
                "
                );
            }
			
		}
        $input = '';
               
		return JHTML::_('select.radiolist',  $options, ''.$control_name.'['.$name.']', $class, 'value', 'text', $value, $control_name.$name).$input;
	}
    
    public function fetchTooltip($label, $description, $xmlElement, $control_name, $name) {
        return;
    }

}
